﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
@* 物料清单列表页面 *@
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet" />
</head>
<body class="layui-padding-3">
    <h3>物料清单列表</h3>
    <br />
    <form class="layui-form layui-row layui-col-space16">
       @*  <div class="layui-col-md4">
            <div class="layui-input-wrap">
                <div class="layui-input-prefix"></div>
                <label class="layui-form-label">工艺路线编号：</label>
                <input type="text"  name="" id="ProcessNumber" class="layui-input" lay-affix="clear" style="width: 200px" />
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-wrap">
                <label class="layui-form-label">工艺名称：</label>
                <input type="text" lay-affix="clear" name=""  id="ProcessName"  class="layui-input" style="width: 200px" />
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-input-wrap">
                <div class="layui-input-prefix"></div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block" style="width: 200px">
                        <select name="interest" lay-filter="aihao" id="ProcessAudit">
                            <option value="0">选择状态</option>
                            <option value=true>有效</option>
                            <option value=false>无效</option>
                        </select>
                    </div>
                </div>
            </div>
        </div> *@
        
        <div class="layui-btn-container layui-col-xs12">
            <a class="layui-btn" onclick="location.href='/BOM/BOMCreate'">
                添加
            </a>
            <button type="reset" class="layui-btn layui-btn-primary">批量删除</button>
            <button type="reset" class="layui-btn layui-btn-primary">导出</button>
            <button class="layui-btn" lay-submit lay-filter="search">
                查询
            </button>
        </div>
    </form>
    <table class="layui-hide" id="ID-table-demo-search"></table>

    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
    <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
    <script>
          layui.use('table',function () {
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var util = layui.util;
            var table = layui.table;
            Seach();
              // 表单取值
            layui.$('#component').on('click', function () {
                Seach()
                return false;//阻止默认 from跳转
            });

            // 搜索提交
            function Seach() {
                var obj={
                    
                }
                console.log(obj)
                $.ajax({
                    type: 'get',
                    url: '@ViewBag.RedDragonWrite'+"/api/BoMs/SearchBoM",
                    data: JSON.stringify(obj),
                    dataType: "json",
                    contentType: "application/json",
                    success: res => {
                        table.render({
                            elem: '#ID-table-demo-search',
                            cols: [[
                                {field:'boMInformId', width:150, title: '序号', sort: true},
                                {field:'boMInformCode', width:150, title: '	物料清单编码'},
                                {field:'boMInformVersion', width:150, title: '物料清单版本'},
                                {field:'materialCode', width:150, title: '物料编码'},
                                {field:'materialName', width:150, title: '物料名称'},
                                {field:'materialUnitName', width:150, title: '单位'},
                                {field:'specifications', width:150, title: '规格'},
                                {field:'createdTime', width:150, title: '创建时间',templet: '<div>{{ layui.util.toDateString(d.createdTime, "yyyy-MM-dd HH:mm:ss") }}</div>'},
                                {field:'createdOwner', title: '创建人', minWidth: 150},
                                {field:'isStatus', width:150, title: '状态', templet: function(d){
                                    if(d.isStatus ==1){
                                        return '<span style="color: blue">有效</span>';
                                    }
                                    else {
                                        return '<span style="color: gray">无效</span>';
                                    }
                                }},//操作列
                                {
                                fixed: 'right', width: 300, title: '操作', align:'center', templet: function (d)
                                {
                                    return '<a class="layui-btn layui-btn-xs layui-icon layui-icon-edit" lay-on="test-page-custom" onclick="Update(' + d.boMInformId + ')">编辑</a><button class="layui-btn layui-btn-xs layui-icon layui-icon-delete"  lay - event="moredel" onclick="Delete(' + d.boMInformId + ')">删除</a > '
                                },
                            }
                            ]],
                            data: res.data,
                            page: true,
                            limits: [2, 3, 4],
                            height: 310
                        });
                        return;

                    }
                });
            };
        });
    </script>
</body>
</html>
